package com.codeanalysissys.backend.entity.response;

import lombok.Data;

@Data
public class Result {
    private int code;
    private String msg;
    private Object data;

    private Result(Builder builder) {
        code = builder.code;
        msg = builder.msg;
        data = builder.data;
    }

    public static class Builder {
        private int code;
        private String msg;
        private Object data;

        public Builder(ResponseCode responseCode) {
            this.code = responseCode.getCode();
            this.msg = responseCode.getMsg();
        }

        public Builder data(Object data) {
            this.data = data;
            return this;
        }

        public Result build() {
            return new Result(this);
        }
    }
}
